#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

/*
int _stack_dir(int *a, int b, int c) {
    return ((&b - a) / labs(&b - a));
}

int stack_dir() {
    int a = 9;
    return _stack_dir(&a, a + 4, a + 2);
}
*/

int stack_dir() {
    int a = 9;
    int b = a + 4;
    return ((&b - &a) / labs(&b - &a));
}

/*
int _args_dir(int *a, int b, int c) {
    return (int)(&c - &b);
}

int args_dir() {
    int a = 9;
    return _args_dir(&a, a + 4, a + 2);
}
*/

#define ONE_CONFIG(key, val) printf("#define %-16s  %d\n", #key, (int)val)

int main() {
    // short int word = 0x0001;
    // char *byte = (char *) &word;

    ONE_CONFIG(PN_SIZE_T,        sizeof(long));
    ONE_CONFIG(LONG_SIZE_T,      sizeof(long));
    ONE_CONFIG(DOUBLE_SIZE_T,    sizeof(double));
    ONE_CONFIG(INT_SIZE_T,       sizeof(int));
    ONE_CONFIG(SHORT_SIZE_T,     sizeof(short));
    ONE_CONFIG(CHAR_SIZE_T,      sizeof(char));
    ONE_CONFIG(LONGLONG_SIZE_T,  sizeof(long long));
    // ONE_CONFIG(PN_LITTLE_ENDIAN, byte[0]);
    // ONE_CONFIG(PN_LITTLE_ENDIAN, __LITTLE_ENDIAN__);
    ONE_CONFIG(PN_LITTLE_ENDIAN, __BYTE_ORDER__ == __BYTE_ORDER__);
    ONE_CONFIG(POTION_PAGESIZE,  sysconf(_SC_PAGE_SIZE));
    ONE_CONFIG(POTION_STACK_DIR, stack_dir());
    // ONE_CONFIG(POTION_ARGS_DIR,  args_dir());

    return 0;
}

